<?php
  if (!defined('XOOPS_ROOT_PATH')) { exit(); }
  
if ( $op == 'delete' ) {
  $poll = new XoopsPoll(intval($_GET['poll_id']));
  
  xoops_cp_header();
  echo '<h4>'._AM_POLLCONF.'</h4>';
  xoops_confirm(array('op' => 'delete_ok', 'poll_id' => $poll->getVar('poll_id')), 'index.php', sprintf(_AM_RUSUREDEL,$poll->getVar('question')));
  xoops_cp_footer();
} elseif ( $op == 'delete_ok' ) {
  $poll = new XoopsPoll(intval($_POST['poll_id']));
  if ( $poll->delete() != false ) {
    XoopsPollOption::deleteByPollId($poll->getVar('poll_id'));
    XoopsPollLog::deleteByPollId($poll->getVar('poll_id'));
    include_once XOOPS_ROOT_PATH.'/class/template.php';
    xoops_template_clear_module_cache($xoopsModule->getVar('mid'));
    xoops_comment_delete($xoopsModule->getVar('mid'), $poll->getVar('poll_id'));
  }
  redirect_header('index.php',1,_AM_DBUPDATED);
}
?>